package com.zhanjixun.springcloud.userweb.vo;

import lombok.Data;
import org.springframework.http.HttpStatus;

/**
 * @author :zhanjixun
 * @date : 2019/8/27 20:58
 */
@Data
public class R {

    private int status;

    private String msg;

    private Object data;

    public static R success(Object data) {
        R r = new R();
        r.setStatus(HttpStatus.OK.value());
        r.setMsg("操作成功！");
        r.setData(data);
        return r;
    }

    public static R success() {
        return success(null);
    }

    public static R error(String msg) {
        R r = new R();
        r.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
        r.setMsg(msg);
        return r;
    }

}
